﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="my_newsForecast.aspx.cs" Inherits="manage_my_newsForecast" MasterPageFile="~/App_Master/AdminMaster2.master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="apply">
  <div class="apply2">
   <%--<uc_left_m:left_menu ID="left_m1" runat="server" />--%>
    <div class="myul_r">
      <div class="mod_pad4">
<div class="hd_admin"><em class="ulimg_admin"><%=title%></em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<a href="my_newsForecast_edit.aspx?t=ad&type=<%=type %>&title=<%=title %>">添加</a> 
</div>
<div class="admin_tab_box1"> 
       <div class="coupons">
            <table class="w top20" width="1060" border="0" cellspacing="0" cellpadding="0"  id="www_zzjs_net">
              <tr class="t">
              <td  style=" width:300px;">标题</td>
                <td  style=" width:460px;">内容</td>             
                <td  style=" width:300px;" >操作</td>
              </tr>            
              <%if (tzlist != null && tzlist.Count > 0)
                { %>
                <%for (int k = 0; k < tzlist.Count; k++)
                  { %>
              <tr >
                <td style=" width:300px;"><%=NtHelp.subtitle(tzlist[k].Title,11)%></td>
                <td  style=" width:460px;"><%=NtHelp.subtitle(tzlist[k].Content, 5)%></td>              
                <td style=" width:300px;">
                <a href="my_newsForecast_edit.aspx?t=edit&id=<%=tzlist[k].id%>&title=<%=title %>&type=<%=type %>" >编辑</a>
                &nbsp;&nbsp;<a href="javascript:delthe('<%=tzlist[k].id%>');" >删除</a></td>
              </tr>
              <%} %>
              <%}
                else
                { %>
             <tr>
                <td colspan='3' ><div class='no_data' style="width:1060px">^_^&nbsp;&nbsp;没有符合条件的数据！</div></td>
              </tr> 
              <%} %>             
            </table>
          </div>
          
                  <div id="changpage" style="text-align:center"> </div> 
        </div>
      </div>
    </div> 
  </div> 
</div>
<script language="javascript" type="text/javascript">
    function delthe(id) {
        if (confirm("删除后不能恢复！确定要将此删除？")) {
            jQuery.ajax({
                url: "/Ajax/Otsql.ashx",
                data: { t: 'delNewsForecast', long_eid: id },
                type: "POST",
                success: function (data) {
                    if (data + '' == 'True' || data + '' == 'true') {
                        alert("删除成功!");
                        window.location.reload();
                    } else {
                        alert('删除失败，请检查!');
                    }
                }
            });

        }
    }
</script>
<script language="javascript" type="text/javascript">
    var obj, j;
    var page = 0;
    var nowPage = 0; //当前页
    var listNum = 10; //每页显示<ul>数
    var PagesLen; //总页数
    var PageNum = 4; //分页链接接数(5个)
    onload = function () {
        obj = document.getElementById("www_zzjs_net").getElementsByTagName("tr");
        j = obj.length
        PagesLen = Math.ceil(j / listNum);
        upPage(0)
    }
    function upPage(p) {
        nowPage = p
        //内容变换
        for (var i = 0; i < j; i++) {
            obj[i].style.display = "none"
        }
        for (var i = p * listNum; i < (p + 1) * listNum; i++) {
            if (obj[i]) obj[i].style.display = "block"
        }
        //分页链接变换
        strS = '<a href="###" onclick="upPage(0)">首页</a>  '
        var PageNum_2 = PageNum % 2 == 0 ? Math.ceil(PageNum / 2) + 1 : Math.ceil(PageNum / 2)
        var PageNum_3 = PageNum % 2 == 0 ? Math.ceil(PageNum / 2) : Math.ceil(PageNum / 2) + 1
        var strC = "", startPage, endPage;
        if (PageNum >= PagesLen) { startPage = 0; endPage = PagesLen - 1 }
        else if (nowPage < PageNum_2) { startPage = 0; endPage = PagesLen - 1 > PageNum ? PageNum : PagesLen - 1 } //首页
        else { startPage = nowPage + PageNum_3 >= PagesLen ? PagesLen - PageNum - 1 : nowPage - PageNum_2 + 1; var t = startPage + PageNum; endPage = t > PagesLen ? PagesLen - 1 : t }
        for (var i = startPage; i <= endPage; i++) {
            if (i == nowPage) strC += '<a href="###" style="color:red;font-weight:700;" onclick="upPage(' + i + ')">' + (i + 1) + '</a> '
            else strC += '<a href="###" onclick="upPage(' + i + ')">' + (i + 1) + '</a> '
        }
        strE = ' <a href="###" onclick="upPage(' + (PagesLen - 1) + ')">尾页</a>  '
        strE2 = nowPage + 1 + "/" + PagesLen + "页" + "  共" + j + "条"
        document.getElementById("changpage").innerHTML = strS + strC + strE + strE2
    }
</script>
</asp:Content>